"""
从工具访问 RunnableConfig
"""
from langchain_core.runnables import RunnableConfig
from langchain_core.tools import tool

@tool
def reverse_tool(text: str, config_param: RunnableConfig) -> str:
    """A test tool that combines input text with a configurable parameter."""
    return (text + config_param["configurable"].get("additional_field", ""))[::-1]

print(reverse_tool.invoke("hello world", config={"configurable": {"additional_field": "123"}}))
